home *** CD-ROM | disk | FTP | other *** search
- @echo off
- ! bu1.bat TO BE EXECUTED VIA BU.BAT AND NEVER DIRECTLY
- ! %1: name of source subdirectory within the current directory
- ! %2: full path of destination directory
- ! %3: file ID to be restored to the variable bu1_fileID before returning
- ! Copyright © 1994 by Rainbow Hill Pty Ltd. All rights reserved.
-
- ! ensure that bu1 is being called from within bu.bat
- if "%bu_dest%" == %%BU_DEST%% goto NO_BU_LBL
-
- onerror DONE_LBL
-
- ! attach to the folder to be copied
- cd "%1"
-
- ! backup all the files (if any)
- if exist * copy/u * "%2"
-
- ! prepare a file with the list of all subdirectories
- dir/b/a-f > BU_TEMPFILE
-
- ! open the file containing the list of all subdirectories
- open BU_TEMPFILE bu1_fileID
-
- :BU1_LOOP_LBL
-
- ! obtain a folder name (it will jump to DONE_LBL on EOF)
- read %bu1_fileID% bu1_aDir
-
- ! remove the double quotes which enclose the name
- decr -bu1_aDir
- decr bu1_aDir
-
- ! execute bu1 recursively to backup the subdirectory
- call bu1 "%bu1_aDir%" "%2\%bu1_aDir%" %bu1_fileID%
-
- ! loop back
- goto BU1_LOOP_LBL
-
- :NO_BU_LBL
- echo.
- echo bu1 should be called from within bu.bat and never executed directly.
- echo.
- goto RETURN_LBL
-
- :DONE_LBL
- if %doserr% == 27 set doserr=0
- if %doserr% == 3 set doserr=0
- close %bu1_fileID%
- if exist BU_TEMPFILE del BU_TEMPFILE
- cd ..
- set bu1_fileID=%3
- set bu1_aDir=
- :RETURN_LBL
-